<?php

class GXMLParser {
	var $xml;
	var $color;
	
	function openXML() {
		$this->xml = "<markers>";		
	}
	
	function addFlag( $info, $lat, $lng, $name = NULL, $region = NULL ) {
		$loc1 = 0;
		$loc2 = 0;
		$this->xml .= "<marker lat='".$lat."' lng='".$lng."'><info name='".$name."' region='".$region."'>".$info."</info></marker>";
	}
		
	function closeXML( $javascript = NULL, $optParam = NULL ) {
		$this->xml .= "</markers>";
		if ($javascript != NULL) {
			$return = $javascript."(\"".$this->xml;
			if ($optParam != NULL) {
				$return .= "\",".$optParam.");";
			} else {
				$return .= "\");";
			}
			echo $return;
		}
	}
	
	function closeXMLWithTags() {
		$this->xml .= "</markers>"; 
		echo "<script type='text/javascript'>getMarkers(\"".$this->xml."\", \"".$this->color."\");</script>";
	}
}

?>